<div class="row m-n">
    <div class="crumbs-bar">
        <div yb-crumbs></div>
    </div>
    <div tabset type="tab">
        <div tab heading="客户赠送款管理" active="activeFlag[0]" ng-click="changeTab(0)">
            <div class="row wrapper-y-sm">
                <div class="operate-bar col-xs-4 font-0">
                    <button class="btn btn-operate m-r-sm" ng-click="addApply()"
                        ng-disabled="!btnPermission.giftManageAdd"
                        title="{{!btnPermission.giftManageAdd?'无权限执行此操作':''}}">新增</button>
                 <button class="btn btn-operate m-r-sm" ng-click="import()"
                       ng-disabled="!btnPermission.giftManageImport"
                       title="{{!btnPermission.giftManageImport?'无权限执行此操作':''}}">导入</button>
                </div>
                <div class="search-bar wrapper-none col-xs-8">
                    <div class="btn-group m-l-xs pull-right">
                        <button type="button" class="btn btn-default base-color" ng-click="search()" title="刷新">
                            <i class="yb-icon ico-refresh"></i>
                        </button>
                        <button type="button" class="btn btn-default base-color" title="配置表格列"
                            ng-click="switchToolbar('ColConfig');">
                            <i class="yb-icon ico-set"></i>
                        </button>
                        <div class="btn btn-default base-color" ng-if="!!btnPermission.giftManageExport">
                            <div title="导出">
                                <i class="yb-icon ico-export-o"></i>
                            </div>
                            <ul class="more-tool">
                                <li yb-download download-url="exportParam.sectionUrl"
                                    download-param="exportParam.sectionParam" download-key="ids">
                                    <i class="yb-icon ico-export-o"></i> 导出
                                </li>
                                <li yb-download download-url="exportParam.allUrl" download-param="condition"
                                    download-duration="3">
                                    <i class="yb-icon ico-export-o"></i> 导出全部
                                </li>
                            </ul>
                        </div>
                    </div>
                    <button class="btn-advance pull-right m-l-xs"
                        ng-click="switchToolbar('AdvanceSearch')">高级搜索</button>
                    <div class="input-group pull-right clearfix">
                        <input type="text" class="form-control txt-search" placeholder="客户名称"
                            ng-model="condition.customerName">
                        <span class="input-group-addon cursor-pointer" ng-click="search(1)">搜索</span>
                    </div>
                </div>
            </div>
            <div yb-advance-search show-toolbar="toolbarConfig.showAdvanceSearch" search-data="search(1)"
                reset-data="reset()">
                <div class="advance-search m-t-sm">
                    <div class="form-group clearfix">
                        <label class="control-label">兑换码：</label>
                        <input type="text" ng-model="condition.ticketCode" class="form-control">
                    </div>
                    <div class="form-group clearfix">
                        <label class="control-label">客户名称：</label>
                        <input type="text" ng-model="condition.customerName" class="form-control">
                    </div>
                    <div class="form-group clearfix">
                        <label class="control-label">车号：</label>
                        <input type="text" ng-model="condition.vinCode" class="form-control">
                    </div>
                    <div class="form-group clearfix">
                        <label class="control-label">手机号：</label>
                        <input type="text" ng-model="condition.phoneNo" class="form-control">
                    </div>

                    <div class="form-group clearfix">
                        <label class="control-label">机型：</label>
                        <input type="text" ng-model="condition.machineType" class="form-control">
                    </div>
                    <div class="form-group clearfix">
                        <label class="control-label">代金券名称：</label>
                        <input type="text" ng-model="condition.ticketName" class="form-control">
                    </div>
                    <div class="form-group clearfix m-b-none">
                        <label class="control-label">创建时间：</label>
                        <input type="text" class="form-control date-picker" ng-model="condition.createTimeStart"
                               datepicker-popup="{{'yyyy-MM-dd'}}" ng-click="switchDataPicker(0)" is-open="datePickerFlag[0]" close-text="关闭"
                               ng-change="checkDate(condition, 'createTimeStart', 'createTimeEnd')" modal-size="small" readonly>
                    </div>
                    <div class="form-group clearfix m-b-none">
                        <label class="control-label"></label>
                        <label class="control-label wave-line">~</label>
                    </div>
                    <div class="form-group clearfix">
                        <label class="control-label"></label>
                        <input type="text" class="form-control date-picker" ng-model="condition.createTimeEnd"
                               datepicker-popup="{{'yyyy-MM-dd'}}" ng-click="switchDataPicker(1)" is-open="datePickerFlag[1]" close-text="关闭"
                               ng-change="checkDate(condition, 'createTimeStart', 'createTimeEnd')" modal-size="small" readonly>
                    </div>
                </div>
            </div>
            <div yb-col-config show-toolbar="toolbarConfig.showColConfig" ng-model="tableConfig" col-fixed="true"
                has-check-col="true" set-tb-style="setFixedWidth()"></div>
            <div class="main-area">
                <div yb-table-fixed class="table-fixed-wrap fix-left" ele-count="4" scroll-area="right">
                    <div class="th-fixed">
                        <table class="table-fixed border-none" width="{{tableConfig.fixedWidth}}">
                            <thead>
                                <tr>
                                    <th width="40" class="text-center th-check border-l-none">
                                        <div yb-check-box yb-checked="markInfo.allCheckedBill"
                                            yb-click="selectAll(dataList, 'Bill')"></div>
                                    </th>
                                    <th ng-repeat="itemCol in tableConfig.tableCol track by $index"
                                        width="{{itemCol.width}}" ng-click="toSort(tableConfig.tableCol, $index)"
                                        ng-show="!!itemCol.isShow && !!itemCol.isFixed">
                                        <div yb-thead-operate ng-model="itemCol" target-width="tableConfig.fixedWidth"
                                            fixed-width="tbStyle.billFixedWidth"></div>
                                    </th>
                                </tr>
                            </thead>
                        </table>
                    </div>
                    <div class="th-scroll-x" ng-style="tbStyle.billFixedWidth">
                        <table class="table-fixed border-none" width="{{tableConfig.scrollWidth}}">
                            <thead>
                                <tr>
                                    <th ng-repeat="itemCol in tableConfig.tableCol track by $index"
                                        width="{{itemCol.width}}" ng-click="toSort(tableConfig.tableCol, $index)"
                                        ng-show="!!itemCol.isShow && !itemCol.isFixed">
                                        <div yb-thead-operate ng-model="itemCol" target-width="tableConfig.scrollWidth">
                                        </div>
                                    </th>
                                </tr>
                            </thead>
                        </table>
                    </div>
                    <div class="td-scroll-y" ng-show="dataList.length > 0">
                        <table class="table-fixed border-none" width="{{tableConfig.fixedWidth}}">
                            <tbody>
                                <tr ng-repeat="item in dataList track by $index"
                                    ng-class="{'row-selected': $index === markInfo.cueRow}"
                                    ng-click="selectRow($index)">
                                    <td width="40" class="text-center border-l-none">
                                        <div yb-check-box yb-checked="item.isChecked"
                                            yb-click="selectSingle(item, dataList, 'Bill')"></div>
                                    </td>
                                    <td class="spill-dots" ng-repeat="itemCol in tableConfig.tableCol track by $index"
                                        width="{{itemCol.width}}" ng-show="!!itemCol.isShow && !!itemCol.isFixed"
                                        title="{{item[itemCol.dataField]}}">
                                        <span
                                            ng-if="!itemCol.clickFn && itemCol.type !== 'operate'">{{item[itemCol.dataField]}}</span>
                                        <a class="btn-operate m-r-xs" ng-click="tdClick(item, itemCol.clickFn)"
                                            ng-if="!!itemCol.clickFn">
                                            {{item[itemCol.dataField]}}
                                        </a>
                                        <div class="font-0" ng-if="itemCol.type === 'operate'">
                                            <button type="button" class="btn btn-operate m-r-xs"
                                                ng-click="editApply(item)" ng-disabled="!btnPermission.giftManageEdit"
                                                title="{{!btnPermission.giftManageEdit?'无权限执行此操作':''}}">编辑</button>
                                            <button type="button" class="btn btn-operate m-r-xs"
                                                ng-click="delApply(item.id)" ng-disabled="!btnPermission.giftManageDel"
                                                title="{{!btnPermission.giftManageDel?'无权限执行此操作':''}}">删除</button>
                                        </div>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="td-scroll" ng-show="dataList.length > 0" ng-style="tbStyle.billFixedWidth">
                        <table class="table-fixed border-none" width="{{tableConfig.scrollWidth}}">
                            <tbody>
                                <tr ng-repeat="item in dataList track by $index"
                                    ng-class="{'row-selected': $index === markInfo.cueRow}"
                                    ng-click="selectRow($index)">
                                    <td class="spill-dots" ng-repeat="itemCol in tableConfig.tableCol track by $index"
                                        width="{{itemCol.width}}" ng-show="!!itemCol.isShow && !itemCol.isFixed"
                                        title="{{item[itemCol.dataField]}}">
                                        <span
                                            ng-if="!itemCol.clickFn && itemCol.type !== 'operate'">{{item[itemCol.dataField]}}</span>
                                        <a class="btn-operate m-r-xs" ng-click="tdClick(item, itemCol.clickFn)"
                                            ng-if="!!itemCol.clickFn">
                                            {{item[itemCol.dataField]}}
                                        </a>
                                        <div class="font-0" ng-if="itemCol.type === 'operate'">
                                            <button type="button" class="btn btn-operate m-r-xs"
                                                ng-click="editApply(item)" ng-disabled="!btnPermission.giftManageEdit"
                                                title="{{!btnPermission.giftManageEdit?'无权限执行此操作':''}}">编辑</button>
                                            <button type="button" class="btn btn-operate m-r-xs"
                                                ng-click="delApply(item.id)" ng-disabled="!btnPermission.giftManageDel"
                                                title="{{!btnPermission.giftManageDel?'无权限执行此操作':''}}">删除</button>
                                        </div>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="no-data w-full text-center p-t" ng-show="dataList.length === 0">暂时没有数据</div>
                </div>
            </div>
            <div class="bottom-area page-bar wrapper-y-sm clearfix">
                <div yb-check-box class="m-t-xs m-r-sm" yb-checked="markInfo.allCheckedBill" yb-check-name="全选"
                    yb-click="selectAll(dataList, 'Bill')"></div>
                <button class="btn btn-operate" ng-click="batchDel()" ng-disabled="!btnPermission.giftManageDel"
                    title="{{!btnPermission.giftManageDel?'无权限执行此操作':''}}">删除</button>
                <div yb-page-info ng-model="pageInfo" yb-refresh="search()"></div>
            </div>
        </div>
        <div tab heading="{{tabFlag.name}}" active="activeFlag[1]" ng-if="activeFlag[1]">
            <form name="orderForm" class="m-t-sm form-horizontal form-up-tb border-b clearfix" novalidate>
                <div class="form-group col-xs-20 m-b-sm">
                    <div class="col-xs-2 wrapper-none"></div>
                    <label class="col-xs-5 control-label max-w-100"><i>*</i>客户名称：</label>
                    <div class="col-xs-4 wrapper-none">
                        <input type="text" name="customerName" class="form-control light-bg" maxlength="20"
                            ng-model="orderObj.customerName" yb-focus required>
                        <div class="msg-block"
                            ng-show="orderForm.customerName.$dirty || (orderForm.customerName.$invalid && submitted)">
                            <div class="error-msg"
                                ng-if="orderForm.customerName.$error.required && !orderForm.customerName.focused">
                                <div class="msg-triangle"></div>
                                必填项，请填写
                            </div>
                        </div>
                    </div>
                </div>

                <div class="form-group col-xs-20 m-b-sm">
                    <div class="col-xs-2 wrapper-none"></div>
                    <label class="col-xs-5 control-label max-w-100"><i>*</i>车号：</label>
                    <div class="col-xs-4 wrapper-none">
                        <input type="text" name="vinCode" class="form-control light-bg" maxlength="20"
                            ng-model="orderObj.vinCode" yb-focus required style="text-transform:uppercase">
                        <div class="msg-block"
                            ng-if="orderForm.vinCode.$dirty || (orderForm.vinCode.$invalid && submitted)">
                            <div class="error-msg"
                                ng-if="orderForm.vinCode.$error.required && !orderForm.vinCode.focused">
                                <div class="msg-triangle"></div>
                                必填项，请填写
                            </div>
                        </div>
                    </div>
                </div>

                <div class="form-group col-xs-20 m-b-sm">
                    <div class="col-xs-2 wrapper-none"></div>
                    <label class="col-xs-5 control-label max-w-100"><i>*</i>机型：</label>
                    <div class="col-xs-4 wrapper-none">
                        <input type="text" name="machineType" class="form-control light-bg" maxlength="20"
                            ng-model="orderObj.machineType" yb-focus required>
                        <div class="msg-block"
                            ng-if="orderForm.machineType.$dirty || (orderForm.machineType.$invalid && submitted)">
                            <div class="error-msg"
                                ng-if="orderForm.machineType.$error.required && !orderForm.machineType.focused">
                                <div class="msg-triangle"></div>
                                必填项，请填写
                            </div>
                        </div>
                    </div>
                </div>

                <div class="form-group col-xs-20 m-b-sm">
                    <div class="col-xs-2 wrapper-none"></div>
                    <label class="col-xs-5 control-label max-w-100"><i>*</i>身份证号：</label>
                    <div class="col-xs-4 wrapper-none">
                        <input type="text" name="idCardNo" class="form-control light-bg" maxlength="20"
                            ng-model="orderObj.idCardNo" yb-focus required>
                        <div class="msg-block"
                            ng-if="orderForm.idCardNo.$dirty || (orderForm.idCardNo.$invalid && submitted)">
                            <div class="error-msg"
                                ng-if="orderForm.idCardNo.$error.required && !orderForm.idCardNo.focused">
                                <div class="msg-triangle"></div>
                                必填项，请填写
                            </div>
                        </div>
                    </div>
                </div>

                <div class="form-group col-xs-20 m-b-sm">
                    <div class="col-xs-2 wrapper-none"></div>
                    <label class="col-xs-5 control-label max-w-100"><i>*</i>手机号：</label>
                    <div class="col-xs-4 wrapper-none">
                        <input type="text" name="phoneNo" class="form-control light-bg" maxlength="20"
                            ng-model="orderObj.phoneNo" yb-focus required>
                        <div class="msg-block"
                            ng-if="orderForm.phoneNo.$dirty || (orderForm.phoneNo.$invalid && submitted)">
                            <div class="error-msg"
                                ng-if="orderForm.phoneNo.$error.required && !orderForm.phoneNo.focused">
                                <div class="msg-triangle"></div>
                                必填项，请填写
                            </div>
                            <div class="error-msg"
                                ng-if="orderForm.phoneNo.$error.mobile && !orderForm.phoneNo.focused">
                                <div class="msg-triangle"></div>
                                手机号格式错误
                            </div>
                        </div>
                    </div>
                </div>

                <div class="form-group col-xs-20 m-b-sm">
                    <div class="col-xs-2 wrapper-none"></div>
                    <label class="col-xs-5 control-label max-w-100"><i>*</i>赠送额度：</label>
                    <div class="col-xs-4 wrapper-none">
                        <input type="text" class="form-control" name="giftAmount" ng-model="orderObj.giftAmount"
                            ng-change="setPrice()" ng-blur="onPriceChange()" yb-number-input max="9999999.99"
                            disable-decimal="false" decimal-places="2" ng-class="{'error': item.qtyErr}" required>
                        <div class="msg-block"
                            ng-show="orderForm.giftAmount.$dirty || (orderForm.giftAmount.$invalid && submitted)">
                            <div class="error-msg"
                                ng-if="orderForm.giftAmount.$error.required && !orderForm.giftAmount.focused">
                                <div class="msg-triangle"></div>
                                必填项，请填写
                            </div>
                        </div>
                    </div>
                </div>

                <div class="form-group col-xs-20 m-b-sm">
                    <div class="col-xs-2 wrapper-none"></div>
                    <label class="col-xs-5 control-label max-w-100"><i>*</i>已用额度：</label>
                    <div class="col-xs-4 wrapper-none">
                        <input type="text" class="form-control" name="usedAmount" ng-model="orderObj.usedAmount"
                            ng-change="setPrice()" ng-blur="onPriceChange()" yb-number-input max="9999999.99"
                            disable-decimal="false" decimal-places="2" ng-class="{'error': item.qtyErr}" required>
                        <div class="msg-block"
                            ng-show="orderForm.usedAmount.$dirty || (orderForm.usedAmount.$invalid && submitted)">
                            <div class="error-msg"
                                ng-if="orderForm.usedAmount.$error.required && !orderForm.usedAmount.focused">
                                <div class="msg-triangle"></div>
                                必填项，请填写
                            </div>
                        </div>
                    </div>
                </div>
                <div class="form-group col-xs-20 m-b-sm">
                    <div class="col-xs-2 wrapper-none"></div>
                    <label class="col-xs-5 control-label max-w-100">剩余额度：</label>
                    <div class="col-xs-4 wrapper-none">
                        <input type="text" class="form-control" name="residueAmount" ng-model="orderObj.residueAmount"
                            readonly yb-number-input max="9999999.99" disable-decimal="false" decimal-places="2"
                            ng-class="{'error': item.qtyErr}">
                    </div>
                </div>
                <div class="form-group col-xs-20 m-b-sm">
                    <div class="col-xs-2 wrapper-none"></div>
                    <label class="col-xs-5 control-label max-w-100"><i>*</i>有效期：</label>
                    <div class="col-xs-4 wrapper-none">
                        <input type="text" name="validityDate" class="form-control" ng-model="orderObj.validityDate"
                            datepicker-popup="{{'yyyy-MM-dd'}}" ng-click="switchDataPicker(1)" min-date="today"
                            is-open="datePickerFlag[1]" close-text="关闭" readonly required>
                        <div class="msg-block"
                            ng-show="orderForm.validityDate.$dirty || (orderForm.validityDate.$invalid && submitted)">
                            <div class="error-msg"
                                ng-if="orderForm.validityDate.$error.required && !orderForm.validityDate.focused">
                                <div class="msg-triangle"></div>
                                必填项，请填写
                            </div>
                        </div>
                    </div>
                </div>
            </form>
            <div class="bottom-area btn-bar text-center clearfix">
                <button type="button" class="btn btn-primary m-r-sm" ng-click="saveData(orderForm.$valid)">提交</button>
                <button type="button" class="btn btn-default" ng-click="cancel()">取消</button>
            </div>
        </div>
        <div tab heading="{{tabFlag.name}}" active="activeFlag[2]" ng-if="activeFlag[2]">
            <form name="orderForm" class="m-t-sm form-horizontal form-up-tb border-b clearfix" novalidate>
                <div class="form-group col-xs-20 m-b-sm">
                    <div class="col-xs-2 wrapper-none"></div>
                    <label class="col-xs-5 control-label max-w-100"><i>*</i>客户名称：</label>
                    <div class="col-xs-4 wrapper-none">
                        <input type="text" class="form-control" name="customerName" ng-model="orderObj.customerName"
                            readonly>
                    </div>
                </div>

                <div class="form-group col-xs-20 m-b-sm">
                    <div class="col-xs-2 wrapper-none"></div>
                    <label class="col-xs-5 control-label max-w-100"><i>*</i>车号：</label>
                    <div class="col-xs-4 wrapper-none">
                        <input type="text" class="form-control" name="vinCode" ng-model="orderObj.vinCode" readonly>
                    </div>
                </div>

                <div class="form-group col-xs-20 m-b-sm">
                    <div class="col-xs-2 wrapper-none"></div>
                    <label class="col-xs-5 control-label max-w-100"><i>*</i>机型：</label>
                    <div class="col-xs-4 wrapper-none">
                        <input type="text" class="form-control" name="machineType" ng-model="orderObj.machineType"
                            readonly>
                    </div>
                </div>

                <div class="form-group col-xs-20 m-b-sm">
                    <div class="col-xs-2 wrapper-none"></div>
                    <label class="col-xs-5 control-label max-w-100"><i>*</i>身份证号：</label>
                    <div class="col-xs-4 wrapper-none">
                        <input type="text" class="form-control" name="idCardNo" ng-model="orderObj.idCardNo" readonly>
                    </div>
                </div>

                <div class="form-group col-xs-20 m-b-sm">
                    <div class="col-xs-2 wrapper-none"></div>
                    <label class="col-xs-5 control-label max-w-100"><i>*</i>手机号：</label>
                    <div class="col-xs-4 wrapper-none">
                        <input type="text" name="phoneNo" class="form-control light-bg" maxlength="20"
                            ng-model="orderObj.phoneNo" yb-focus required>

                        <div class="msg-block"
                            ng-show="orderForm.phoneNo.$dirty || (orderForm.phoneNo.$invalid && submitted)">
                            <div class="error-msg"
                                ng-if="orderForm.phoneNo.$error.required && !orderForm.phoneNo.focused">
                                <div class="msg-triangle"></div>
                                必填项，请填写
                            </div>
                            <div class="error-msg"
                                ng-show="orderForm.phoneNo.$error.mobile && !orderForm.phoneNo.focused">
                                <div class="msg-triangle"></div>
                                手机号格式错误
                            </div>
                        </div>
                    </div>
                </div>

                <div class="form-group col-xs-20 m-b-sm">
                    <div class="col-xs-2 wrapper-none"></div>
                    <label class="col-xs-5 control-label max-w-100"><i>*</i>赠送额度：</label>
                    <div class="col-xs-4 wrapper-none">
                        <input type="text" class="form-control" name="giftAmount" ng-model="orderObj.giftAmount"
                            ng-change="setPrice()" ng-blur="onPriceChange()" yb-number-input max="9999999.99"
                            disable-decimal="false" decimal-places="2" ng-class="{'error': item.qtyErr}" required>
                        <div class="msg-block"
                            ng-show="orderForm.giftAmount.$dirty || (orderForm.giftAmount.$invalid && submitted)">
                            <div class="error-msg"
                                ng-if="orderForm.giftAmount.$error.required && !orderForm.giftAmount.focused">
                                <div class="msg-triangle"></div>
                                必填项，请填写
                            </div>
                        </div>
                    </div>
                </div>

                <div class="form-group col-xs-20 m-b-sm">
                    <div class="col-xs-2 wrapper-none"></div>
                    <label class="col-xs-5 control-label max-w-100"><i>*</i>已用额度：</label>
                    <div class="col-xs-4 wrapper-none">
                        <input type="text" class="form-control" name="usedAmount" ng-model="orderObj.usedAmount"
                            yb-number-input max="9999999.99" disable-decimal="false" decimal-places="2" readonly>
                    </div>
                </div>
                <div class="form-group col-xs-20 m-b-sm">
                    <div class="col-xs-2 wrapper-none"></div>
                    <label class="col-xs-5 control-label max-w-100">剩余额度：</label>
                    <label class="col-xs-4 control-label p-l-n text-left spill-dots">
                        <input type="text" class="form-control" name="residueAmount" ng-model="orderObj.residueAmount"
                            readonly yb-number-input max="9999999.99" disable-decimal="false" decimal-places="2">
                    </label>
                </div>
                <div class="form-group col-xs-20 m-b-sm">
                    <div class="col-xs-2 wrapper-none"></div>
                    <label class="col-xs-5 control-label max-w-100"><i>*</i>有效期：</label>
                    <div class="col-xs-4 wrapper-none">
                        <input type="text" name="validityDate" class="form-control" ng-model="orderObj.validityDate"
                            datepicker-popup="{{'yyyy-MM-dd'}}" ng-click="switchDataPicker(1)" min-date="today"
                            is-open="datePickerFlag[1]" close-text="关闭" readonly required>
                        <div class="msg-block"
                            ng-show="orderForm.validityDate.$dirty || (orderForm.validityDate.$invalid && submitted)">
                            <div class="error-msg"
                                ng-if="orderForm.validityDate.$error.required && !orderForm.validityDate.focused">
                                <div class="msg-triangle"></div>
                                必填项，请填写
                            </div>
                        </div>
                    </div>
                </div>
            </form>
            <div class="bottom-area btn-bar text-center clearfix">
                <button type="button" class="btn btn-primary m-r-sm" ng-click="saveData(orderForm.$valid)">提交</button>
                <button type="button" class="btn btn-default" ng-click="cancel()">取消</button>
            </div>
        </div>
    </div>
</div>
